package com.rocky.ssm.service;

import com.rocky.ssm.mapper.CommentMapper;
import com.rocky.ssm.model.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2017/8/9.
 */

@Service
public class EvaluationService implements IEvaluation{

    @Autowired
    private CommentMapper commentMapper;

    public Comment getCommentById(int id) {

        return commentMapper.selectByPrimaryKey(id);
    }

    public List<Comment> getCommentList() {
        List<Comment> list= commentMapper.selectList();
        return list;
    }

    public int save(Comment comment) {
        int result=commentMapper.insert(comment);

        return result;
    }

    public int update(Comment comment) {
        int result=commentMapper.updateByPrimaryKey(comment);
        return result;
    }

    public int delete(int id) {
        int result=commentMapper.deleteByPrimaryKey(id);
        return result;
    }
}
